/**
 * 
 */
package com.atozsoft.wf;

import java.util.ArrayList;
import java.util.List;

import com.eos.foundation.data.DataObjectUtil;
import com.eos.system.annotation.Bizlet;

import commonj.sdo.DataObject;

/**
 * @author houfy
 * @date 2014-11-21 14:12:46
 *
 */
@Bizlet("")
public class ConvertStringToArray {
	/**
	 * @param str
	 * @return array
	 * @author houfy
	 */
	@Bizlet("")
	public static String[] convertStringtoArray(String str) {
		// TODO 自动生成的方法存根
		if( str == null || str.equals(""))
		{
			return null;
		}
		else
		{
			return str.split(","); 
		}
	}
	
	@Bizlet("")
	public static String[] convertStringtoArray2(String str) {
		// TODO 自动生成的方法存根
		if( str == null || str.equals(""))
		{
			return null;
		}
		else
		{
			String newstr = str.replace("|", ",");
			return newstr.split(","); 
		}
	}
	
	@Bizlet("")
	public static List<DataObject> getAddexamineArray(String strEmp,String isSortStr,int addexamineid) {
		 List<DataObject> list = new ArrayList<DataObject>();
		 boolean isSort = false; //是否排序
		 if("1".equals(isSortStr)) isSort = true;
		 
		 if(strEmp.indexOf(",") > 0){
			 String[] strEmps = strEmp.split(",");
			 for(int i=0,len=strEmps.length;i<len;i++){
				 DataObject info = DataObjectUtil.createDataObject("com.atozsoft.wf.process.ProcessConfigAddapproveP");  //加审人员信息
				 info.set("empid", strEmps[i]);
				 info.set("sortno", i + 1);
				 info.set("executestatus", "0");
				 info.set("sortstatus", isSort?((i == 0)?"1":"0"):"1");  //用于标识当前加审人
				 info.set("addexamineid", addexamineid);
				 list.add(info);
			 }
		 }else{
			 DataObject info = DataObjectUtil.createDataObject("com.atozsoft.wf.process.ProcessConfigAddapproveP");  //加审人员信息
			 info.set("empid", strEmp);
			 info.set("sortno",1);
			 info.set("executestatus", "0");
			 info.set("sortstatus", "1");  //用于标识当前加审人
			 info.set("addexamineid", addexamineid);
			 list.add(info); 
		 }
		 
		return list;
	}
}
